﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class user_contractinfo : Wozuji.Logic.PageLogin
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Header.Title = "足迹网 用户联系方式设置";
        
        if (!IsPostBack)
        {
            Wozuji.Model.Member_t mb = new Wozuji.Model.Member_t();
            Wozuji.BLL.Member_t mbbll = new Wozuji.BLL.Member_t();
            mb = mbbll.GetModel(Convert.ToInt32(Session["userid"].ToString()));
            cellphome.Text = mb.Member_Mphone;
            qq.Text = mb.Member_Qq;
            msn.Text = mb.Member_Msn;
            index.Text = mb.Member_Index;
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        bool valid = true;
        

        //校验qq号
        if(Wozuji.Common.PageValidate.IsNumber(qq.Text.ToString()))
        {
            qqmsg.Text = "";
        }
        else
        {
            valid = false;
            qqmsg.Text = "不是数字哦";
        }
        if (!Wozuji.Common.PageValidate.IsPhone(cellphome.Text.ToString()))
        {
            valid = false;
            cellphonemsg.Text = "不全为数字哦";
        }
        else if(cellphome.Text.Length!=11)
        { 
            valid=false;
            cellphonemsg.Text = "没有11位哦";
            
        }
        else
        {
            cellphonemsg.Text="";
        }
        if (!Wozuji.Common.PageValidate.IsEmail(msn.Text.ToString()))
        {
            msnmsg.Text = "不是邮箱";
            valid = false;
        }
        else
        {
            msnmsg.Text = "";
        }

        if (valid)
        {
            Wozuji.Model.Member_t mb = new Wozuji.Model.Member_t();
            Wozuji.BLL.Member_t mbbll = new Wozuji.BLL.Member_t();
            mb = mbbll.GetModel(Convert.ToInt32(Session["userid"].ToString()));
            mb.Member_Index = index.Text.ToString();
            mb.Member_Qq = qq.Text.ToString();
            mb.Member_Mphone = cellphome.Text.ToString();
            mb.Member_Msn = msn.Text.ToString();
            mb.Member_Money = mb.Member_Money + 1;
            mb.Member_ActiveValue = mb.Member_ActiveValue + 1;
            mbbll.Update(mb);
            resultmsg.Text = "保存成功";
            
            
        }
    }
}
